package com.dut.bbs.adapter;

import java.util.List;
import java.util.Map;

import com.dut.bbs.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MaillistAdapter extends BaseAdapter {
	
	private List<Map<String, String>> ItemList;
	private LayoutInflater mInflater;
	public MaillistAdapter(Context context, List<Map<String, String>> ItemList) {
		this.ItemList = ItemList;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return ItemList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return ItemList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		// TODO Auto-generated method stub
		if(convertView==null){
			convertView = mInflater.inflate(R.layout.mailitem, null);
		}
		Map<String, String> dataMap = ItemList.get(position);
		TextView title = (TextView) convertView.findViewById(R.id.mailTitle);
		TextView author = (TextView) convertView.findViewById(R.id.mailAuthor);
		TextView date = (TextView) convertView.findViewById(R.id.mailDate);
//		TextView reply = (TextView) convertView.findViewById(R.id.artReply);
//		((TextView)convertView.findViewById(R.id.arttv_author)).setText("发信人：");
//		((TextView)convertView.findViewById(R.id.arttv_reply)).setVisibility(View.GONE); 
//		reply.setVisibility(View.GONE);
		title.setText(dataMap.get("title"));
		author.setText("发信人:"+dataMap.get("author"));
		date.setText("时间:"+dataMap.get("date"));
		return convertView;
	}

}
